﻿using Microsoft.Extensions.DependencyInjection;
using ZeroSum.Application;
using ZeroSumDBM.Application.Services.DataBases;
using ZeroSumDBM.Application.Services.DataServers;
using ZeroSumDBM.Application.Services.Icons;

namespace ZeroSumDBM.Application;

public static class DependencyRegistrar
{
    public static IServiceCollection AddZeroSumDBMApplicationLayer(this IServiceCollection services)
    {
        services.AddZeroSumApplicationLayer();
        services.AddApplicationServices();
        services.AddAuthorization();

        return services;
    }

    private static IServiceCollection AddApplicationServices(this IServiceCollection services)
    {
        services.AddTransient<IDataServeService, DataServeService>();
        services.AddTransient<IDataServerService, DataServerService>();
        services.AddTransient<IIconService, IconService>();

        return services;
    }

    private static IServiceCollection AddAuthorization(this IServiceCollection services)
    {
        services.AddDistributedMemoryCache();
        return services;
    }
}